package isjinhao.jlox.grammar.expression;

import isjinhao.jlox.grammar.expression.represention.Expression;
import isjinhao.jlox.lexical.LoxScanner;
import isjinhao.jlox.lexical.TokenSequence;

/**
 * @Author ISJINHAO
 * @Date 2021/2/25 23:04
 */
public class ExpressionEvaluatorTest {

    public static void main(String[] args) {

//        String expr = "(1.5 + 2.5) * ((4 - 3) / (-1 - -2)) * (1 + 5 - 9)";
        String expr = "true and (1 < 2) or (7 < 2)";

        LoxScanner loxScanner = new LoxScanner(expr);
        TokenSequence tokenSequence = loxScanner.scanTokens();
        ExpressionParser expressionParser = new ExpressionParser(tokenSequence);
        Expression parse = expressionParser.parse();
        System.out.println(parse.calculate());

    }

}
